package com.rocket.bedroom.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rocket.bedroom.dao.PositionDao;
import com.rocket.bedroom.pojo.PositionEntity;
import com.rocket.bedroom.service.IPositionService;
import org.apache.shiro.util.Assert;
import org.springframework.stereotype.Service;

/**
 * @Author: 周毅
 * @ClassName:
 * @Description: TODO
 * @Date: Create in 20:43 2020/6/7
 * @ModifyBy:
 */
@Service
public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity> implements IPositionService
{

    @Override
    public PositionEntity getPositionByUser(Long positionId)
    {
        Assert.notNull(positionId, "get positionByUser positionId is null");
        LambdaQueryWrapper<PositionEntity> lambdaQuery = Wrappers.lambdaQuery();
        lambdaQuery.eq(PositionEntity::getPositionId, positionId);
        PositionEntity one = super.getOne(lambdaQuery);
        return one;
    }
}
